package com.core.sysDict;

import java.util.List;

import javax.servlet.http.HttpSession;

import com.common.web.CommonKeys;
import com.core.sysDict.bo.SysDictBo;
import com.core.sysDict.dto.SysDictDto;
import com.core.sysDict.pojo.SysDict;
import com.util.JSONUtil;

public class SysDictJsp {
    public static String getSysDict(String key_no,String key_value){
    	String key_caption="";
    	SysDictBo sysDictBo = new SysDictBo();
    	SysDict sysDict=new SysDict();
    	sysDict.setKey_no(key_no);
    	sysDict.setKey_value(key_value);
    	SysDict sysDict1=sysDictBo.getById(sysDict);
    	key_caption=sysDict1.getKey_caption();
    	return key_caption;
    	
    }
	@SuppressWarnings("unchecked")
	public static String getSysDictJson(HttpSession session){
    	String json="";
    	List<SysDictDto> sysDictList = (List<SysDictDto>) session.getAttribute(CommonKeys.SESSION_SYSDICT);
    	try {
			json=JSONUtil.toJSONstringNew(sysDictList);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
    	//URLEncoder
    	return "{\"data\": "+json+"}";
    	//SysDictDto sysDict
    }
}
